package com.auth.manage.user.domain.entity.convertor;

import com.auth.manage.common.user.api.responce.UserInfo;
import com.auth.manage.common.user.api.responce.UserResponce;
import com.auth.manage.user.domain.entity.User;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.factory.Mappers;

import java.util.Collection;

@Mapper(nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)  // 如果源属性为null，就不覆盖
public interface UserConvertor {

    // Mappers.getMapper(UserConvertor.class):编译期生成实现对象并返回，他实现了接口中的所有方法（如do2VO）,如果项目用Spring（配置componentModel = "spring"），就可以省略这个，因为Spring会自动帮我们生成该实现类
    // 接口中定义的字段默认是 public static final
    UserConvertor INSTANCE = Mappers.getMapper(UserConvertor.class);


    Collection<UserResponce> do2VO(Collection<User> user);

    UserResponce do2VO(User user);


}

